<?php

namespace Kateba\UserBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Kateba\UserBundle\Entity\Address
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Kateba\UserBundle\Entity\AddressRepository")
 */
class Address {

    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var Kateba\UserBundle\Entity\User $user
     * 
     * @ORM\ManyToOne(targetEntity="Kateba\UserBundle\Entity\User", inversedBy="addresses")
     * @ORM\JoinColumn(name="userId", referencedColumnName="id", onDelete="CASCADE", onUpdate="CASCADE", nullable=false)
     */
    private $user;

    /**
     * @var Doctrine\Common\Collections\ArrayCollection $userOrders
     * 
     * @ORM\OneToMany(targetEntity="Kateba\OrderBundle\Entity\UserOrder", mappedBy="address", cascade={"all"}, orphanRemoval=true)
     */
    private $userOrders;

    /**
     * @var text $address
     *
     * @ORM\Column(name="address", type="text")
     */
    private $address;

    /**
     * @var string $zipcode
     *
     * @ORM\Column(name="zipcode", type="string", length=9)
     */
    private $zipcode;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId() {
        return $this->id;
    }

    /**
     * Set address
     *
     * @param text $address
     */
    public function setAddress($address) {
        $this->address = $address;
    }

    /**
     * Get address
     *
     * @return text 
     */
    public function getAddress() {
        return $this->address;
    }

    /**
     * Set zipcode
     *
     * @param string $zipcode
     */
    public function setZipcode($zipcode) {
        $this->zipcode = $zipcode;
    }

    /**
     * Get zipcode
     *
     * @return string 
     */
    public function getZipcode() {
        return $this->zipcode;
    }

    public function __construct() {
        $this->userOrders = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Set user
     *
     * @param Kateba\UserBundle\Entity\User $user
     */
    public function setUser(\Kateba\UserBundle\Entity\User $user) {
        $this->user = $user;
    }

    /**
     * Get user
     *
     * @return Kateba\UserBundle\Entity\User 
     */
    public function getUser() {
        return $this->user;
    }

    /**
     * Add userOrders
     *
     * @param Kateba\OrderBundle\Entity\UserOrder $userOrders
     */
    public function addUserOrder(\Kateba\OrderBundle\Entity\UserOrder $userOrders) {
        $this->userOrders[] = $userOrders;
    }

    /**
     * Get userOrders
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getUserOrders() {
        return $this->userOrders;
    }

}